﻿Public Class ChamCong
    Dim data_ As DataTable
    Dim xlcc As XLChamCong
    Dim xlnv As XLNhanVien
    Dim dsnv As ArrayList

    Private Sub ChamCong_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        xlnv = New XLNhanVien
        dsnv = New ArrayList
        data_ = New DataTable
        xlcc = New XLChamCong
        dsnv = xlnv.BUS_ArrDSNV()
        data_ = xlcc.BUS_LoadData()
        Rload()
    End Sub
    Private Sub Rload()
        If data_.Rows.Count <> 0 Then
            dataCC.DataSource = data_
        End If
    End Sub
   

    Private Sub bt_luu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_luu.Click
        'xlcc = New XLChamCong
        'layDLieu()
        'If xlcc.BUS_SaveData(data_, DateTime.Now.Month & "/" & DateTime.Now.Year) = True Then
        '    MessageBox.Show("Lưu Thành Công ", "Thông Báo", MessageBoxButtons.OK)
        'End If
        'dataCC.DataSource = data_
    End Sub

    Private Sub bt_lammoi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_lammoi.Click
        'xlcc = New XLChamCong
        'xlcc.BUS_LamMoi(data_, dsnv, DateTime.Now.Month & "/" & DateTime.Now.Year)
        'Rload()
    End Sub
    
    Private Sub dataCC_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dataCC.CellContentClick
        For Each dr As DataRow In data_.Rows
            If dr("MaNV") = dataCC.CurrentRow.Cells(1).Value Then
                dr("1") = dataCC.CurrentRow.Cells(3).Value
                dr("2") = dataCC.CurrentRow.Cells(4).Value
                dr("3") = dataCC.CurrentRow.Cells(5).Value
                dr("4") = dataCC.CurrentRow.Cells(6).Value
                dr("5") = dataCC.CurrentRow.Cells(7).Value
                dr("6") = dataCC.CurrentRow.Cells(8).Value
                dr("7") = dataCC.CurrentRow.Cells(9).Value
                dr("8") = dataCC.CurrentRow.Cells(10).Value
                dr("9") = dataCC.CurrentRow.Cells(11).Value
                dr("10") = dataCC.CurrentRow.Cells(12).Value
                dr("11") = dataCC.CurrentRow.Cells(13).Value
                dr("12") = dataCC.CurrentRow.Cells(14).Value
                dr("13") = dataCC.CurrentRow.Cells(15).Value
                dr("14") = dataCC.CurrentRow.Cells(16).Value
                dr("15") = dataCC.CurrentRow.Cells(17).Value
                dr("16") = dataCC.CurrentRow.Cells(18).Value
                dr("17") = dataCC.CurrentRow.Cells(19).Value
                dr("18") = dataCC.CurrentRow.Cells(20).Value
                dr("19") = dataCC.CurrentRow.Cells(21).Value
                dr("20") = dataCC.CurrentRow.Cells(22).Value
                dr("21") = dataCC.CurrentRow.Cells(23).Value
                dr("22") = dataCC.CurrentRow.Cells(24).Value
                dr("23") = dataCC.CurrentRow.Cells(25).Value
                dr("24") = dataCC.CurrentRow.Cells(26).Value
                dr("25") = dataCC.CurrentRow.Cells(27).Value
                dr("26") = dataCC.CurrentRow.Cells(28).Value
                dr("27") = dataCC.CurrentRow.Cells(29).Value
                dr("28") = dataCC.CurrentRow.Cells(30).Value
                dr("29") = dataCC.CurrentRow.Cells(31).Value
                dr("30") = dataCC.CurrentRow.Cells(32).Value
                dr("31") = dataCC.CurrentRow.Cells(33).Value
            End If
        Next
    End Sub
End Class

